<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Quiz
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: view.tpl 2010-07-02 17:53 ermek $
 * @author     Ermek
 */
?>

<?php
  $current_page = $this->paginator->getCurrentPageNumber();
?>

<script type="text/javascript">
  var pageAction =function(page)
  {
    window.location.href= en4.core.baseUrl+'inviter/invitations/'+page;
  }
</script>
  
<div class="headline">
  <div class="tabs">
    <?php
      // Render the menu
      echo $this->navigation()
				->menu()
        ->setContainer($this->navigation)
        ->render();
    ?>
  </div>
</div>

<div class="global_form">
    <div>
        <div class="my_invitations">
	        <h3><?php echo $this->translate('INVITER_Pending Invitations'); ?></h3>
	        <p class="form-description"><?php echo $this->translate('INVITER_VIEWS_SCRIPTS_INVITATIONS_INDEX_DESCRIPTION'); ?></p>
	        <br/>
	        <?php if( $this->paginator->getTotalItemCount() > 0 ): ?>
		           	<table class="my_invitation_list"">
									<?php foreach ($this->paginator as $item): ?>
		                <tr>
		                    <td width='15px' style='padding:2px;'>
		                    	<img src="application/modules/Inviter/externals/images/providers/<?php echo $item->provider; ?>_logo.png" border='0' height='20px'/>
		                    </td>
		                    <td width='220px'><?php echo $item->recipient_name; ?></td>
		                    <td width='130px'><?php echo $this->timestamp(strtotime($item->sent_date)); ?></td>
		                    <td width='220px'>
		                        <a href="<?php echo $this->url(array('module'=>'inviter', 'controller'=>'invitations', 'action'=>'delete'), 'inviter_invitations_delete') ?>/<?php echo $item->invite_id; ?>" class="buttonlink delete_btn smoothbox"><?php echo $this->translate('delete'); ?></a>
                            <?php if ($this->appId && $item->provider == 'facebook') : ?>
                              <a href="<?php echo $this->url(array('module'=>'inviter', 'controller'=>'invitations', 'action'=>'resend', 'invite_id' => $item->invite_id, 'page' => $current_page), 'default') ?>" class="buttonlink send_btn"><?php echo $this->translate('INVITER_send new invite'); ?></a>
                            <?php else : ?>
		                          <a href="<?php echo $this->url(array('module'=>'inviter', 'controller'=>'invitations', 'action'=>'sendnew'), 'inviter_invitations_sendnew') ?>/<?php echo $item->invite_id; ?>" class="buttonlink send_btn smoothbox"><?php echo $this->translate('INVITER_send new invite'); ?></a>
                            <?php endif; ?>
		                    </td>
		                </tr>
			        		<?php endforeach; ?> 
		            </table>
	        <?php else:
									echo $this->translate('INVITER_There are no pending invitations.'); 
							endif;	
					?>
					<?php echo $this->paginationControl($this->paginator, null, array("pagination/inviterpagination.tpl","inviter")); ?>
      	</div>
    </div>
</div>
